<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="${base}/manager/" />
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
</head>
<script src="js/jquery-3.5.0.js"></script>
<script src="layer/layer.js"></script>
<script>
// 	function tolist(){
// 		location.href="GoodsServelet?opr=query";
// 	}
// 	let success = "${success}";
// 	if(success!=""){
// 		layer.alert(success);
// 	}
	window.addEventListener("load",function(){
		document.getElementById("scategories").value="${goods.categoryid}";
	
	})
</script>

<body>
	<div class="panel admin-panel">
		<div class="panel-head" id="add">
			<strong><span class="icon-pencil-square-o"></span>修改商品</strong>
		</div>
		<div class="body-content">
			<form method="post" class="form-x" action="GoodsServelet"
				enctype="multipart/form-data">
				<input type="hidden" name="opr" value="update" />
				<input type="hidden" name="hidimg" value="${goods.image}" />
				<input type="hidden" name="id" value="${goods.id}" />
				<div class="form-group">
					<div class="label">
						<label>商品名称：</label>
					</div>
					<div class="field">
						<input type="text" class="input" name="upname" value="${goods.name}" />
						<div class="tips">${msg}</div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>商品类别：</label>
					</div>
					<div class="field">
						<select name="choosecategory" class="input w50" id="scategories">
<!-- 							<option value="0">请选择商品类别</option> -->
							<c:forEach items="${categories}" var="category">
								<option value="${category.id}">${category.name}</option>
							</c:forEach>
						</select>
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>库存：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" name="stock" value="${goods.stock}" />
						<div class="tips">${msg2}</div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>市场价：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" name="marketprice" value="${goods.marketprice}" />
						<div class="tips">${msg3}</div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>销售价：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" name="saleprice" value="${goods.saleprice}" />
						<div class="tips">${msg4}</div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>图片：</label>
					</div>
					<div class="field">
						<input type="file" class="input w50" name="image" />
						<div class="tips">${msg5}</div>
					</div>
					<div class="field">
						<span>${goods.image}</span>
						<img src="${goods.image}" style="width: 100px; height: 120px">
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>描述：</label>
					</div>
					<div class="field">
						<!-- 加载编辑器的容器 -->
						<script id="container" name="content" type="text/plain">
       						${goods.description}
    					</script>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label></label>
					</div>
					<div class="field">
						<button class="button bg-main icon-check-square-o" type="submit">
							提交</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>

<!-- 配置文件 -->
<script type="text/javascript" src="ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
	var ue = UE.getEditor('container');
</script>

</html>